package com.framework.loippi.controller.api;

import com.alibaba.fastjson.JSONObject;
import com.framework.loippi.api.utils.ApiUtils;
import com.framework.loippi.entity.AskInfo;
import com.framework.loippi.service.AskInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName AskInfoController
 * @Description TODO
 * @Author fsociety
 * @Date 6/12/2019 下午3:22
 * @Version 1.0
 */
@Controller("apiAdkInfoController")
@Api(tags = {"在线问诊记录"})
@RequestMapping("/api/askInfo")
public class AskInfoController {

    @Resource
    AskInfoService askInfoService;

    @RequestMapping(value = "/findAll.json", method = RequestMethod.POST, produces = {"application/json; charset=UTF-8"})
    @ApiOperation(value = "根据id查询问诊记录")
    public @ResponseBody
    String findAllByIds(@RequestBody @Param(value = "obj") JSONObject requestJson) {
        JSONObject json = requestJson.getJSONObject("obj");
        List<AskInfo> list = askInfoService.findAllByIds(Integer.parseInt(json.getString("doctorId")), Integer.parseInt(json.getString("patientWx")));

        return ApiUtils.success(list);
    }
}
